/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-qingdao = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-beijing = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-chengdu = 'dbs-api.cn-chengdu.aliyuncs.com',
    cn-zhangjiakou = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-huhehaote = 'dbs-api.cn-huhehaote.aliyuncs.com',
    cn-hangzhou = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shanghai = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shenzhen = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-hongkong = 'dbs-api.cn-hangzhou.aliyuncs.com',
    ap-southeast-1 = 'dbs-api.ap-southeast-1.aliyuncs.com',
    ap-southeast-2 = 'dbs-api.ap-southeast-2.aliyuncs.com',
    ap-southeast-3 = 'dbs-api.ap-southeast-3.aliyuncs.com',
    ap-southeast-5 = 'dbs-api.ap-southeast-5.aliyuncs.com',
    ap-northeast-1 = 'dbs-api.ap-northeast-1.aliyuncs.com',
    us-west-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    us-east-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    eu-central-1 = 'dbs-api.eu-central-1.aliyuncs.com',
    cn-hangzhou-finance = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shanghai-finance-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    cn-shenzhen-finance-1 = 'dbs-api.cn-hangzhou.aliyuncs.com',
    ap-south-1 = 'dbs-api.ap-south-1.aliyuncs.com',
    eu-west-1 = 'dbs-api.eu-west-1.aliyuncs.com',
    me-east-1 = 'dbs-api.me-east-1.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('dbs', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ChangeResourceGroupRequest {
  clientToken?: string(name='ClientToken', description='The client token that is used to ensure the idempotence of the request.', example='dbs'),
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the resource group to which you want to move the resource.

This parameter is required.', example='rg-aekz4kee6******'),
  regionCode?: string(name='RegionCode', description='The region ID of the instance.', example='cn-hangzhou'),
  resourceId?: string(name='ResourceId', description='The ID of the resource.

This parameter is required.', example='dbs1jyajqk******'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to backupplan.

This parameter is required.', example='backupplan'),
}

model ChangeResourceGroupResponseBody = {
  code?: string(name='Code', description='The status code returned.', example='Param.NotFound'),
  data?: string(name='Data', description='Indicates whether the resource was successfully moved. Valid values:

*   **true**: The resource was successfully moved.
*   **false**: The resource failed to be moved.', example='true'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='Request.Forbidden'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='RAM DENY'),
  message?: string(name='Message', description='The additional information.', example='The resource group is forbidden to operate'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='04EBD9F5-F06F-5302-8499-005C72*******'),
  success?: string(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**: The request was successful.
*   **false**: The request failed.', example='true'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Moves a resource from one resource group to another.
 *
 * @param request ChangeResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, runtime: Util.RuntimeOptions): ChangeResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.newResourceGroupId)) {
    query['NewResourceGroupId'] = request.newResourceGroupId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ChangeResourceGroup',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Moves a resource from one resource group to another.
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeResourceGroupWithOptions(request, runtime);
}

model CreateAdvancedPolicyRequest {
  instanceName?: string(name='InstanceName', example='pc-2ze3nrr64c5****'),
  regionCode?: string(name='RegionCode', example='cn-shanghai'),
}

model CreateAdvancedPolicyResponseBody = {
  code?: string(name='Code', example='Success'),
  data?: boolean(name='Data', example='true'),
  errCode?: string(name='ErrCode', example='Success'),
  errMessage?: string(name='ErrMessage', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', example='instanceName can not be empty.'),
  requestId?: string(name='RequestId', example='1EFBAC73-4A72-5AD0-BE27-932491FCB848'),
  success?: string(name='Success', example='true'),
}

model CreateAdvancedPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAdvancedPolicyResponseBody(name='body'),
}

/**
 * @summary 开启高级备份策略
 *
 * @param request CreateAdvancedPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAdvancedPolicyResponse
 */
async function createAdvancedPolicyWithOptions(request: CreateAdvancedPolicyRequest, runtime: Util.RuntimeOptions): CreateAdvancedPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAdvancedPolicy',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 开启高级备份策略
 *
 * @param request CreateAdvancedPolicyRequest
 * @return CreateAdvancedPolicyResponse
 */
async function createAdvancedPolicy(request: CreateAdvancedPolicyRequest): CreateAdvancedPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAdvancedPolicyWithOptions(request, runtime);
}

model CreateDownloadRequest {
  bakSetId?: string(name='BakSetId', description='The ID of the backup set. You can call the [DescribeBackups](https://help.aliyun.com/document_detail/26273.html) operation to query the ID of the backup set.

> This parameter is required if the BakSetType parameter is set to full.', example='146005****'),
  bakSetSize?: string(name='BakSetSize', description='The size of the full backup set. Unit: bytes. You can call the [DescribeBackups](https://help.aliyun.com/document_detail/26273.html) operation to query the size of the full backup set.', example='216****'),
  bakSetType?: string(name='BakSetType', description='The type of the download task. Valid values:

*   **full**: downloads a full backup set.
*   **pitr**: downloads a backup set at a specific point in time.', example='full'),
  downloadPointInTime?: string(name='DownloadPointInTime', description='The point in time at which the backup set is downloaded. Specify a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

> This parameter is required if the BakSetType parameter is set to pitr.', example='1661331864000'),
  formatType?: string(name='FormatType', description='The format to which the downloaded backup set is converted. Valid values:

*   **CSV**
*   **SQL**
*   **Parquet**

> This parameter is required.', example='CSV'),
  instanceName?: string(name='InstanceName', description='The ID of the instance.

This parameter is required.', example='rm-wz994c1t1****'),
  regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides. You can call the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/26231.html) operation to query the region ID of the instance.

This parameter is required.', example='cn-beijing'),
  targetBucket?: string(name='TargetBucket', description='The name of the OSS bucket that is used to store the backup set.

*   This parameter is required if the TargetType parameter is set to OSS.
*   Make sure that your account is granted the **AliyunDBSDefaultRole** permission. For more information, see [Use RAM for resource authorization](https://help.aliyun.com/document_detail/26307.html). You can also grant permissions based on the operation instructions in the Resource Access Management (RAM) console.', example='test123'),
  targetOssRegion?: string(name='TargetOssRegion', description='The region in which the OSS bucket resides.

> This parameter is required if the TargetType parameter is set to OSS.', example='cn-beijing'),
  targetPath?: string(name='TargetPath', description='The destination path to which the backup set is downloaded.

> This parameter is required if the TargetType parameter is set to OSS.', example='test_db/path'),
  targetType?: string(name='TargetType', description='The type of the destination to which the backup set is downloaded. Valid values:

*   **OSS**
*   **URL**', example='OSS'),
}

model CreateDownloadResponseBody = {
  code?: string(name='Code', description='The status code returned.', example='DBS.ParamIsInValid'),
  data?: {
    backupSetTime?: long(name='BackupSetTime', description='The point in time of the backup set if the task is used to download a backup set at a specific point in time. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1661373070000'),
    bakSetId?: string(name='BakSetId', description='The ID of the full backup set.', example='146005****'),
    dbList?: string(name='DbList', description='The database and table information that is returned if databases and tables are filtered by the download task.', example='testdb'),
    downloadStatus?: string(name='DownloadStatus', description='The state of the download task. Valid values:

*   initializing: The download task was being initialized.
*   queuing: The download task was queuing.
*   running: The download task was running.
*   failed: The download task failed.
*   finished: The download task was complete.
*   expired: The download task expired.

> If the TargetType parameter is set to URL, the download task expires in three days after the task is complete.', example='initializing'),
    exportDataSize?: long(name='ExportDataSize', description='The size of the downloaded data. Unit: bytes.', example='0'),
    format?: string(name='Format', description='The format to which the downloaded data is converted.', example='CSV'),
    gmtCreate?: long(name='GmtCreate', description='The time when the download task was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1661940917570'),
    importDataSize?: long(name='ImportDataSize', description='The size of the processed data. Unit: bytes.', example='0'),
    progress?: string(name='Progress', description='The number of tables that have been downloaded and the total number of tables to be downloaded.

> If the task is in the preparation stage, 0/0 is returned.', example='0/0'),
    regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides.', example='cn-beijing'),
    targetPath?: string(name='TargetPath', description='The destination path to which the backup set is downloaded.

>  This parameter is returned if the value of **TargetType is OSS**.', example='test_db/path'),
    targetType?: string(name='TargetType', description='The type of the destination to which the backup set is downloaded.', example='URL'),
    taskId?: string(name='TaskId', description='The ID of the download task.', example='dt-qxnsfq5s****'),
  }(name='Data', description='The information about the download task.'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='DBS.ParamIsInValid'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='formatType can not be empty'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='formatType can not be empty'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A08F908D-2C35-583F-93C1-ED80753F****'),
  success?: string(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**: The request was successful.
*   **false**: The request failed.', example='true'),
}

model CreateDownloadResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDownloadResponseBody(name='body'),
}

/**
 * @summary Creates an advanced download task for an ApsaraDB RDS for MySQL instance, an ApsaraDB RDS for PostgreSQL instance, or a PolarDB for MySQL cluster.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * For the instances that meet your business requirements, you can create an advanced download task by point in time or backup set. You can set the download destination to a URL or directly upload the downloaded backup set to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request CreateDownloadRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDownloadResponse
 */
async function createDownloadWithOptions(request: CreateDownloadRequest, runtime: Util.RuntimeOptions): CreateDownloadResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bakSetId)) {
    query['BakSetId'] = request.bakSetId;
  }
  if (!Util.isUnset(request.bakSetSize)) {
    query['BakSetSize'] = request.bakSetSize;
  }
  if (!Util.isUnset(request.bakSetType)) {
    query['BakSetType'] = request.bakSetType;
  }
  if (!Util.isUnset(request.downloadPointInTime)) {
    query['DownloadPointInTime'] = request.downloadPointInTime;
  }
  if (!Util.isUnset(request.formatType)) {
    query['FormatType'] = request.formatType;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.targetBucket)) {
    query['TargetBucket'] = request.targetBucket;
  }
  if (!Util.isUnset(request.targetOssRegion)) {
    query['TargetOssRegion'] = request.targetOssRegion;
  }
  if (!Util.isUnset(request.targetPath)) {
    query['TargetPath'] = request.targetPath;
  }
  if (!Util.isUnset(request.targetType)) {
    query['TargetType'] = request.targetType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDownload',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an advanced download task for an ApsaraDB RDS for MySQL instance, an ApsaraDB RDS for PostgreSQL instance, or a PolarDB for MySQL cluster.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * For the instances that meet your business requirements, you can create an advanced download task by point in time or backup set. You can set the download destination to a URL or directly upload the downloaded backup set to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request CreateDownloadRequest
 * @return CreateDownloadResponse
 */
async function createDownload(request: CreateDownloadRequest): CreateDownloadResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDownloadWithOptions(request, runtime);
}

model DeleteSandboxInstanceRequest {
  backupPlanId?: string(name='BackupPlanId', description='The ID of the backup schedule. You can call the [DescribeBackupPlanList](https://help.aliyun.com/document_detail/437215.html) operation to query the ID of the backup schedule.

> If your instance is an ApsaraDB RDS for MySQL instance, you can [configure automatic access to a data source](https://help.aliyun.com/document_detail/193091.html) to automatically add the instance to DBS and obtain the ID of the backup schedule.

This parameter is required.', example='1hxxxx8xxxxxa'),
  instanceId?: string(name='InstanceId', description='The ID of the sandbox instance. You can call the [DescribeSandboxInstances](https://help.aliyun.com/document_detail/437257.html) operation to query the ID of the sandbox instance.

This parameter is required.', example='1jxxxxnxxx1xc'),
  zoneId?: string(name='ZoneId'),
}

model DeleteSandboxInstanceResponseBody = {
  code?: string(name='Code', description='The error code returned if the request failed.', example='Param.NotFound'),
  data?: string(name='Data', description='The returned data.', example='operation forbidden due to sandbox is creating.'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='Param.NotFound'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='The specified parameter %s value is not valid.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4F1888AC-1138-4995-B9FE-D2734F61C058'),
  success?: string(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model DeleteSandboxInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSandboxInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a sandbox instance.
 *
 * @description This operation is available only for the Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DeleteSandboxInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSandboxInstanceResponse
 */
async function deleteSandboxInstanceWithOptions(request: DeleteSandboxInstanceRequest, runtime: Util.RuntimeOptions): DeleteSandboxInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSandboxInstance',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a sandbox instance.
 *
 * @description This operation is available only for the Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DeleteSandboxInstanceRequest
 * @return DeleteSandboxInstanceResponse
 */
async function deleteSandboxInstance(request: DeleteSandboxInstanceRequest): DeleteSandboxInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSandboxInstanceWithOptions(request, runtime);
}

model DescribeBackupDataListRequest {
  backupId?: string(name='BackupId', example='213064****'),
  backupMethod?: string(name='BackupMethod', example='Snapshot'),
  backupMode?: string(name='BackupMode', example='Automated'),
  backupScale?: string(name='BackupScale', example='DBInstance'),
  backupStatus?: string(name='BackupStatus', example='OK'),
  backupType?: string(name='BackupType', example='FullBackup'),
  dataSourceId?: string(name='DataSourceId', example='test****'),
  endTime?: string(name='EndTime', example='2024-04-17T17:00:32Z'),
  instanceIsDeleted?: boolean(name='InstanceIsDeleted', example='false'),
  instanceName?: string(name='InstanceName', example='pc-2ze3nrr64c5******'),
  instanceRegion?: string(name='InstanceRegion', example='cn-hangzhou'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  regionCode?: string(name='RegionCode', example='cn-hangzhou'),
  sceneType?: string(name='SceneType', example='LEVEL_1'),
  startTime?: string(name='StartTime', example='2024-04-17T17:00:16Z'),
}

model DescribeBackupDataListResponseBody = {
  code?: string(name='Code', example='Success'),
  data?: {
    content?: [ 
      {
        backupDownloadURL?: string(name='BackupDownloadURL', example='http://oss.com/****'),
        backupEndTime?: string(name='BackupEndTime', example='2024-04-17T17:00:32Z'),
        backupId?: string(name='BackupId', example='213088****'),
        backupIntranetDownloadURL?: string(name='BackupIntranetDownloadURL', example='http://oss.com/****'),
        backupLocation?: string(name='BackupLocation', example='logic'),
        backupMethod?: string(name='BackupMethod', example='Snapshot'),
        backupMode?: string(name='BackupMode', example='Automated'),
        backupName?: string(name='BackupName', example='logic_backup'),
        backupScale?: string(name='BackupScale', example='DBInstance'),
        backupSize?: long(name='BackupSize', example='25669140480'),
        backupStartTime?: string(name='BackupStartTime', example='2024-04-17T17:00:16Z'),
        backupStatus?: string(name='BackupStatus', example='OK'),
        backupType?: string(name='BackupType', example='FullBackup'),
        checksum?: string(name='Checksum', example='84a4c16431f969712e6895992719****'),
        consistentTime?: long(name='ConsistentTime', example='1713373221'),
        encryption?: string(name='Encryption', example='psk2'),
        engine?: string(name='Engine', example='polardb_mysql'),
        engineVersion?: string(name='EngineVersion', example='5.7'),
        expectExpireTime?: string(name='ExpectExpireTime', example='2024-04-19T05:00:49Z'),
        expectExpireType?: string(name='ExpectExpireType', example='DELAY'),
        instanceName?: string(name='InstanceName', example='pc-2ze3nrr64c5******'),
        isAvail?: int32(name='IsAvail', example='1'),
        polarSnapshot?: {
          dumpId?: long(name='DumpId', example='abc****'),
          dumpSize?: long(name='DumpSize', example='25669140589'),
          expectExpireTime?: string(name='ExpectExpireTime', example='2024-04-19T05:00:49Z'),
          expectExpireType?: string(name='expectExpireType', example='DELAY'),
        }(name='PolarSnapshot'),
        supportDeletion?: int32(name='SupportDeletion', example='0'),
      }
    ](name='Content'),
    extra?: string(name='Extra', example='dbtest'),
    pageNumber?: long(name='PageNumber', example='1'),
    pageSize?: long(name='PageSize', example='20'),
    totalElements?: long(name='TotalElements', example='1'),
    totalPages?: long(name='TotalPages', example='1'),
  }(name='Data'),
  errCode?: string(name='ErrCode', example='Request.Forbidden'),
  errMessage?: string(name='ErrMessage', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', example='The specified parameter %s value is not valid.'),
  requestId?: string(name='RequestId', example='95A5FFD0-7F46-5A7D-9DFE-6A376B4E2A28'),
  success?: string(name='Success', example='true'),
}

model DescribeBackupDataListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeBackupDataListResponseBody(name='body'),
}

/**
 * @summary 备份数据列表查询接口
 *
 * @param request DescribeBackupDataListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeBackupDataListResponse
 */
async function describeBackupDataListWithOptions(request: DescribeBackupDataListRequest, runtime: Util.RuntimeOptions): DescribeBackupDataListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupId)) {
    query['BackupId'] = request.backupId;
  }
  if (!Util.isUnset(request.backupMethod)) {
    query['BackupMethod'] = request.backupMethod;
  }
  if (!Util.isUnset(request.backupMode)) {
    query['BackupMode'] = request.backupMode;
  }
  if (!Util.isUnset(request.backupScale)) {
    query['BackupScale'] = request.backupScale;
  }
  if (!Util.isUnset(request.backupStatus)) {
    query['BackupStatus'] = request.backupStatus;
  }
  if (!Util.isUnset(request.backupType)) {
    query['BackupType'] = request.backupType;
  }
  if (!Util.isUnset(request.dataSourceId)) {
    query['DataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceIsDeleted)) {
    query['InstanceIsDeleted'] = request.instanceIsDeleted;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.instanceRegion)) {
    query['InstanceRegion'] = request.instanceRegion;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.sceneType)) {
    query['SceneType'] = request.sceneType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupDataList',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 备份数据列表查询接口
 *
 * @param request DescribeBackupDataListRequest
 * @return DescribeBackupDataListResponse
 */
async function describeBackupDataList(request: DescribeBackupDataListRequest): DescribeBackupDataListResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupDataListWithOptions(request, runtime);
}

model DescribeBackupPolicyRequest {
  instanceName?: string(name='InstanceName', example='pc-2ze3nrr64c5******'),
  regionCode?: string(name='RegionCode', example='cn-beijing'),
}

model DescribeBackupPolicyResponseBody = {
  code?: string(name='Code', example='Success'),
  data?: {
    advanceDataPolicies?: [ 
      {
        autoCreated?: boolean(name='AutoCreated', example='true'),
        bakType?: string(name='BakType', example='F'),
        destRegion?: string(name='DestRegion', example='cn-beijing'),
        destType?: string(name='DestType', example='level1'),
        dumpAction?: string(name='DumpAction', example='copy'),
        filterKey?: string(name='FilterKey', example='dayOfWeek'),
        filterType?: string(name='FilterType', example='crontab'),
        filterValue?: string(name='FilterValue', example='1,2,3,4,5,6,7'),
        policyId?: string(name='PolicyId'),
        retentionType?: string(name='RetentionType', example='delay'),
        retentionValue?: string(name='RetentionValue', example='7'),
        srcRegion?: string(name='SrcRegion', example='cn-beijing'),
        srcType?: string(name='SrcType', example='db'),
        strategyId?: string(name='StrategyId', example='71930ac2e9f15e41615e10627c******'),
      }
    ](name='AdvanceDataPolicies'),
    advanceLogPolicies?: [ 
      {
        destRegion?: string(name='DestRegion', example='cn-shanghai'),
        destType?: string(name='DestType', example='level1'),
        enableLogBackup?: boolean(name='EnableLogBackup', example='1'),
        logRetentionType?: string(name='LogRetentionType', example='delay'),
        logRetentionValue?: string(name='LogRetentionValue', example='3'),
        srcRegion?: string(name='SrcRegion', example='cn-beijing'),
        srcType?: string(name='SrcType', example='level1'),
        strategyId?: string(name='StrategyId', example='6s67c7i3y8f8p72808p******'),
      }
    ](name='AdvanceLogPolicies'),
    backupMethod?: string(name='BackupMethod', example='Physical'),
    backupPriority?: int32(name='BackupPriority', example='0'),
    backupRetentionPeriod?: int32(name='BackupRetentionPeriod', example='7'),
    backupRetentionPolicyOnClusterDeletion?: string(name='BackupRetentionPolicyOnClusterDeletion', example='LATEST'),
    category?: string(name='Category', example='Standard'),
    enableBackup?: int32(name='EnableBackup', example='1'),
    enableIncBackup?: int32(name='EnableIncBackup', example='0'),
    enableLogBackup?: int32(name='EnableLogBackup', example='1'),
    highFrequencyBakInterval?: int32(name='HighFrequencyBakInterval', example='120'),
    highSpaceUsageProtection?: string(name='HighSpaceUsageProtection', example='Enable'),
    incBackupInterval?: int32(name='IncBackupInterval', example='-1'),
    localLogRetentionSpace?: int32(name='LocalLogRetentionSpace', example='30'),
    logBackupLocalRetentionNumber?: string(name='LogBackupLocalRetentionNumber', example='10'),
    logBackupRetention?: int32(name='LogBackupRetention', example='7'),
    preferredBackupDate?: string(name='PreferredBackupDate', example='1010101'),
    preferredBackupWindow?: string(name='PreferredBackupWindow', example='23:00Z-24:00Z'),
    preferredBackupWindowBegin?: string(name='PreferredBackupWindowBegin', example='23:00Z'),
  }(name='Data'),
  errCode?: string(name='ErrCode', example='Success'),
  errMessage?: string(name='ErrMessage', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', example='instanceName can not be empty.'),
  requestId?: string(name='RequestId', example='54A63B3B-AA10-1CC3-A6BB-6CCE98D19628'),
  success?: string(name='Success', example='true'),
}

model DescribeBackupPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeBackupPolicyResponseBody(name='body'),
}

/**
 * @summary 获取备份策略接口
 *
 * @param request DescribeBackupPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeBackupPolicyResponse
 */
async function describeBackupPolicyWithOptions(request: DescribeBackupPolicyRequest, runtime: Util.RuntimeOptions): DescribeBackupPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeBackupPolicy',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取备份策略接口
 *
 * @param request DescribeBackupPolicyRequest
 * @return DescribeBackupPolicyResponse
 */
async function describeBackupPolicy(request: DescribeBackupPolicyRequest): DescribeBackupPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeBackupPolicyWithOptions(request, runtime);
}

model DescribeDBTablesRecoveryBackupSetRequest {
  instanceId?: string(name='InstanceId'),
  regionCode?: string(name='RegionCode'),
}

model DescribeDBTablesRecoveryBackupSetResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DescribeDBTablesRecoveryBackupSetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBTablesRecoveryBackupSetResponseBody(name='body'),
}

/**
 * @param request DescribeDBTablesRecoveryBackupSetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBTablesRecoveryBackupSetResponse
 */
async function describeDBTablesRecoveryBackupSetWithOptions(request: DescribeDBTablesRecoveryBackupSetRequest, runtime: Util.RuntimeOptions): DescribeDBTablesRecoveryBackupSetResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBTablesRecoveryBackupSet',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDBTablesRecoveryBackupSetRequest
 * @return DescribeDBTablesRecoveryBackupSetResponse
 */
async function describeDBTablesRecoveryBackupSet(request: DescribeDBTablesRecoveryBackupSetRequest): DescribeDBTablesRecoveryBackupSetResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBTablesRecoveryBackupSetWithOptions(request, runtime);
}

model DescribeDBTablesRecoveryStateRequest {
  instanceId?: string(name='InstanceId'),
  regionCode?: string(name='RegionCode'),
}

model DescribeDBTablesRecoveryStateResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DescribeDBTablesRecoveryStateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBTablesRecoveryStateResponseBody(name='body'),
}

/**
 * @param request DescribeDBTablesRecoveryStateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBTablesRecoveryStateResponse
 */
async function describeDBTablesRecoveryStateWithOptions(request: DescribeDBTablesRecoveryStateRequest, runtime: Util.RuntimeOptions): DescribeDBTablesRecoveryStateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBTablesRecoveryState',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDBTablesRecoveryStateRequest
 * @return DescribeDBTablesRecoveryStateResponse
 */
async function describeDBTablesRecoveryState(request: DescribeDBTablesRecoveryStateRequest): DescribeDBTablesRecoveryStateResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBTablesRecoveryStateWithOptions(request, runtime);
}

model DescribeDBTablesRecoveryTimeRangeRequest {
  instanceId?: string(name='InstanceId'),
  regionCode?: string(name='RegionCode'),
}

model DescribeDBTablesRecoveryTimeRangeResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model DescribeDBTablesRecoveryTimeRangeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDBTablesRecoveryTimeRangeResponseBody(name='body'),
}

/**
 * @param request DescribeDBTablesRecoveryTimeRangeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDBTablesRecoveryTimeRangeResponse
 */
async function describeDBTablesRecoveryTimeRangeWithOptions(request: DescribeDBTablesRecoveryTimeRangeRequest, runtime: Util.RuntimeOptions): DescribeDBTablesRecoveryTimeRangeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDBTablesRecoveryTimeRange',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeDBTablesRecoveryTimeRangeRequest
 * @return DescribeDBTablesRecoveryTimeRangeResponse
 */
async function describeDBTablesRecoveryTimeRange(request: DescribeDBTablesRecoveryTimeRangeRequest): DescribeDBTablesRecoveryTimeRangeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDBTablesRecoveryTimeRangeWithOptions(request, runtime);
}

model DescribeDownloadBackupSetStorageInfoRequest {
  backupSetId?: string(name='BackupSetId', description='The ID of the backup set.', example='30****'),
  duration?: string(name='Duration', description='The validity period of the URL that is used as the download destination. Take note of the following items:

*   Default value: 7200. This means that the URL is valid for 2 hours by default.
*   Valid values: 300 to 86400. Unit: seconds. This means that you can specify a validity period in the range of 5 minutes to 1 day.
*   Before you specify this parameter, convert the validity period to seconds. For example, if you want to set the validity period of the URL to 5 minutes, enter 300.

This parameter is required.', example='300'),
  instanceName?: string(name='InstanceName', description='The ID of the instance.

> The **BackupSetId** parameter is required if you specify the **InstanceName** parameter.', example='rm-uf6qqf569n435****'),
  regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides. You can call the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/26231.html) operation to query the region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  taskId?: string(name='TaskId', description='The download task ID.

*   The **BackupSetId** and **InstanceName** parameters are required if you do not specify the **TaskId** parameter.
*   To view the download task ID, go to the instance details page in the console and click **Backup and Restoration** in the left-side navigation pane. On the **Backup Download** tab, view the task ID.', example='dt-s0ugzak9****'),
}

model DescribeDownloadBackupSetStorageInfoResponseBody = {
  code?: string(name='Code', description='The error code returned if the request failed.', example='DBS.ParamIsInValid'),
  data?: {
    expirationTime?: long(name='ExpirationTime', description='The validity period of the URL.

> This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1661329050'),
    privateUrl?: string(name='PrivateUrl', description='The private download URL of the backup set.', example='http://dbs-137383785969****-cn-hangzhou-1iv12nblw****.oss-cn-hangzhou-internal.aliyuncs.com/dt-u7u4bufa****/dbs_target_file_path/test_123'),
    publicUrl?: string(name='PublicUrl', description='The public download URL of the backup set.', example='http://dbs-137383785969****-cn-hangzhou-1iv12nblw****.oss-cn-hangzhou.aliyuncs.com/dt-u7u4bufa****/dbs_target_file_path/test_456'),
  }(name='Data', description='The returned data.'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='DBS.ParamIsInValid'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='Argument: regionCode Must not be empty'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='Argument: regionCode Must not be empty'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='44B8C2F5-919D-5D29-BCD5-DEB03467****'),
  success?: string(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**: The request was successful.
*   **false**: The request failed.', example='true'),
}

model DescribeDownloadBackupSetStorageInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDownloadBackupSetStorageInfoResponseBody(name='body'),
}

/**
 * @summary Queries the storage information of a downloaded backup set.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadBackupSetStorageInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDownloadBackupSetStorageInfoResponse
 */
async function describeDownloadBackupSetStorageInfoWithOptions(request: DescribeDownloadBackupSetStorageInfoRequest, runtime: Util.RuntimeOptions): DescribeDownloadBackupSetStorageInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.taskId)) {
    query['TaskId'] = request.taskId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDownloadBackupSetStorageInfo',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the storage information of a downloaded backup set.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadBackupSetStorageInfoRequest
 * @return DescribeDownloadBackupSetStorageInfoResponse
 */
async function describeDownloadBackupSetStorageInfo(request: DescribeDownloadBackupSetStorageInfoRequest): DescribeDownloadBackupSetStorageInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDownloadBackupSetStorageInfoWithOptions(request, runtime);
}

model DescribeDownloadSupportRequest {
  instanceName?: string(name='InstanceName', description='The ID of the instance.

This parameter is required.', example='rm-bp1a48p922r4b****'),
  regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides. You can call the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/26231.html) operation to query the region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeDownloadSupportResponseBody = {
  code?: string(name='Code', description='The error code returned if the request failed.', example='DBS.ParamIsInValid'),
  data?: string(name='Data', description='Indicates whether the advanced download feature is supported. Valid values:

*   **true**: The advanced download feature is supported.
*   **false**: The advanced download feature is not supported.', example='true'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='DBS.ParamIsInValid'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='Argument: regionCode Must not be empty'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='Argument: regionCode Must not be empty'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='F1A186F7-7B34-5C11-A903-EE23876B****'),
  success?: string(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**: The request was successful.
*   **false**: The request failed.', example='true'),
}

model DescribeDownloadSupportResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDownloadSupportResponseBody(name='body'),
}

/**
 * @summary Queries whether an instance supports the advanced download feature.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * You can create an advanced download task by point in time or backup set. You can set the download destination to a URL or directly upload the downloaded backup set to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadSupportRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDownloadSupportResponse
 */
async function describeDownloadSupportWithOptions(request: DescribeDownloadSupportRequest, runtime: Util.RuntimeOptions): DescribeDownloadSupportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDownloadSupport',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether an instance supports the advanced download feature.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * You can create an advanced download task by point in time or backup set. You can set the download destination to a URL or directly upload the downloaded backup set to your Object Storage Service (OSS) bucket to facilitate data analysis and offline archiving.
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadSupportRequest
 * @return DescribeDownloadSupportResponse
 */
async function describeDownloadSupport(request: DescribeDownloadSupportRequest): DescribeDownloadSupportResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDownloadSupportWithOptions(request, runtime);
}

model DescribeDownloadTaskRequest {
  backupSetId?: string(name='BackupSetId', description='The ID of the backup set generated when you create a download task. You can call the [DescribeBackups](https://help.aliyun.com/document_detail/26273.html) operation to query the ID.', example='216****'),
  currentPage?: string(name='CurrentPage', description='The page number of the page to return.', example='1'),
  datasourceId?: string(name='DatasourceId', description='The ID of the Database Backup (DBS) data source. Specify the parameter in the format of *ds-${Instance ID}_${regionId}*.', example='ds-rm-2ze8g2am97624****_cn-hangzhou'),
  endTime?: string(name='EndTime', description='The end of the time range to query. Specify this parameter as a timestamp of the LONG type. Unit: milliseconds.', example='1661941556000'),
  instanceName?: string(name='InstanceName', description='The ID of the instance.

> This parameter is required.', example='rm-bp1imnmcjxdz7****'),
  orderColumn?: string(name='OrderColumn', description='The column based on which the entries are sorted. By default, the entries are sorted by the time when the download task was created. Set the value to **gmt_create**.', example='gmt_create'),
  orderDirect?: string(name='OrderDirect', description='The order in which you want to sort the entries. Valid values:

*   **asc**: the ascending order.
*   **desc**: the descending order. This is the default value.', example='desc'),
  pageSize?: string(name='PageSize', description='The number of entries to return on each page.', example='50'),
  regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides. You can call the [DescribeDBInstanceAttribute](https://help.aliyun.com/document_detail/26231.html) operation to query the region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. Specify this parameter as a timestamp of the LONG type. Unit: milliseconds.', example='1661941554000'),
  state?: string(name='State', description='The state of the download task. Valid values:

*   **Initializing**: The download task is being initialized.
*   **queueing**: The download task is queuing.
*   **running**: The download task is running.
*   **failed**: The download task fails.
*   **finished**: The download task is complete.
*   **expired**: The download task expires.', example='queueing'),
  taskType?: string(name='TaskType', description='The type of the download task. Valid values:

*   **full**: downloads a full backup set.
*   **pitr**: downloads a backup set at a specific point in time.', example='full'),
}

model DescribeDownloadTaskResponseBody = {
  code?: string(name='Code', description='The error code returned if the request fails.', example='DBS.InternalError'),
  data?: {
    content?: {
      list?: [ 
      {
        backupSetTime?: string(name='BackupSetTime', description='The point in time of the backup set if the task is used to download a backup set at a specific point in time. The value is a timestamp of the LONG type. Unit: millisecond.', example='1663162216000'),
        bakSetId?: string(name='BakSetId', description='The ID of the full backup set.', example='148261****'),
        dbList?: string(name='DbList', description='The details of the databases.', example='[dbtest]'),
        downloadStatus?: string(name='DownloadStatus', description='The status of the download task. Valid values:

*   **Initializing**: The download task is being initialized.
*   **queuing**: The download task is queuing.
*   **running**: The download task is running.
*   **failed**: The download task fails.
*   **finished**: The download task is complete.
*   **expired**: The download task expires.', example='queueing'),
        exportDataSize?: string(name='ExportDataSize', description='The amount of output data. Unit: bytes.', example='0'),
        format?: string(name='Format', description='The format to which the downloaded backup set is converted. Valid values:

*   **csv**
*   **SQL**
*   **Parquet**', example='csv'),
        gmtCreate?: string(name='GmtCreate', description='The time when the download task was created. The value is a timestamp.', example='1663321957000'),
        importDataSize?: string(name='ImportDataSize', description='The amount of data that is processed. Unit: bytes.', example='0'),
        progress?: string(name='Progress', description='The number of tables that have been downloaded and the total number of tables to be downloaded.', example='0/0'),
        regionCode?: string(name='RegionCode', description='The ID of the region in which the instance resides.', example='cn-hangzhou'),
        targetPath?: string(name='TargetPath', description='The destination path to which the data is downloaded if the value of **TargetType is OSS**.', example='test_db/path'),
        targetType?: string(name='TargetType', description='The type of the method in which the backup set is downloaded. Valid values:

*   **OSS**
*   **URL**', example='URL'),
        taskId?: string(name='TaskId', description='The download task ID.', example='dt-qxntlvgu****'),
      }
    ](name='List')
    }(name='Content', description='The details of the task.'),
    extra?: string(name='Extra', description='The extra description of the download tasks.', example='dbtest'),
    pageNumber?: long(name='PageNumber', description='The page number of the returned page. The value must be an integer that is greater than 0. Default value: 1.', example='1'),
    pageSize?: long(name='PageSize', description='The number of entries returned per page.', example='10'),
    totalElements?: long(name='TotalElements', description='The total number of full backup tasks.', example='1'),
    totalPages?: long(name='TotalPages', description='The total number of returned pages.', example='2'),
  }(name='Data', description='The details of the tasks.'),
  errCode?: string(name='ErrCode', description='The error code returned if the request fails.', example='DBS.InternalError'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request fails.', example='instanceName can not be empty'),
  message?: string(name='Message', description='The error message returned if the request fails.', example='instanceName can not be empty'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='5D285EB9-A443-592D-9F3D-A888FAC3****'),
  success?: string(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**: The request was successful.
*   **false**: The request failed.', example='true'),
}

model DescribeDownloadTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDownloadTaskResponseBody(name='body'),
}

/**
 * @summary Queries the advanced download tasks for an ApsaraDB RDS for MySQL instance, an ApsaraDB RDS for PostgreSQL instance, or a PolarDB for MySQL cluster.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadTaskRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDownloadTaskResponse
 */
async function describeDownloadTaskWithOptions(request: DescribeDownloadTaskRequest, runtime: Util.RuntimeOptions): DescribeDownloadTaskResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.datasourceId)) {
    query['DatasourceId'] = request.datasourceId;
  }
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.orderColumn)) {
    query['OrderColumn'] = request.orderColumn;
  }
  if (!Util.isUnset(request.orderDirect)) {
    query['OrderDirect'] = request.orderDirect;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.state)) {
    query['State'] = request.state;
  }
  if (!Util.isUnset(request.taskType)) {
    query['TaskType'] = request.taskType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDownloadTask',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the advanced download tasks for an ApsaraDB RDS for MySQL instance, an ApsaraDB RDS for PostgreSQL instance, or a PolarDB for MySQL cluster.
 *
 * @description ### [](#)Supported database engines
 * *   ApsaraDB RDS for MySQL
 * *   ApsaraDB RDS for PostgreSQL
 * *   PolarDB for MySQL
 * ### [](#)References
 * *   [Download the backup files of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/98819.html)
 * *   [Download the backup files of an ApsaraDB RDS for PostgreSQL instance](https://help.aliyun.com/document_detail/96774.html)
 * *   [Download the backup files of a PolarDB for MySQL cluster](https://help.aliyun.com/document_detail/2627635.html)
 *
 * @param request DescribeDownloadTaskRequest
 * @return DescribeDownloadTaskResponse
 */
async function describeDownloadTask(request: DescribeDownloadTaskRequest): DescribeDownloadTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDownloadTaskWithOptions(request, runtime);
}

model DescribeSandboxBackupSetsRequest {
  backupPlanId?: string(name='BackupPlanId', description='The ID of the backup schedule. You can call the [DescribeBackupPlanList](https://help.aliyun.com/document_detail/437215.html) operation to query the ID of the backup schedule.

> If your instance is an ApsaraDB RDS for MySQL instance, you can [configure automatic access to a data source](https://help.aliyun.com/document_detail/193091.html) to automatically add the instance to DBS and obtain the ID of the backup schedule.

This parameter is required.', example='1hxxxx8xxxxxa'),
  backupSetId?: string(name='BackupSetId', description='The ID of the backup set. If this parameter is specified, only the snapshot of the specified backup set is returned. If this parameter is not specified, all the snapshots of the backup schedule are returned.', example='1xxxx2xxxxx1e'),
  pageNumber?: string(name='PageNumber', description='The number of the page to return. Pages start from page 1. Default value: 1.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries to return on each page. Valid values:

*   30: This is the default value.
*   50\\\\.
*   100\\\\.', example='30'),
}

model DescribeSandboxBackupSetsResponseBody = {
  code?: string(name='Code', description='The error code returned if the request failed.', example='Param.NotFound'),
  data?: string(name='Data', description='The returned data. The following parameters are contained:

*   **backupSetTime**: the point in time when the snapshot was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.
*   **backupSetId**: the ID of the backup set.
*   **backupSetType**: the type of the snapshot. A value of **Full** indicates that the snapshot is a full backup snapshot. A value of **Inc** indicates that the snapshot is an incremental backup snapshot.
*   **backupPlanId**: the ID of the backup schedule.', example='"Data": {     "number": 2,     "size": 2,     "content": [       {         "backupSetTime": "2021-08-28T23:12:31Z",         "backupSetId": "Inc_1hxxxx8xxxxxa_20210801064200_mysql-bin.000134",         "backupSetType": "Inc",         "backupPlanId": "1hxxxx8xxxxxa"       },       {         "backupSetTime": "2021-08-28T22:42:28Z",         "backupSetId": "1hxxxx8xxxxxa_20210829064228",         "backupSetType": "FULL",         "backupPlanId": "1hxxxx8xxxxxa"       }     ],     "totalElements": 2   },'),
  errCode?: string(name='ErrCode', description='The error code returned if the request failed.', example='Param.NotFound'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request failed.', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', description='The error message returned if the request failed.', example='The specified parameter %s value is not valid.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4F1888AC-1138-4995-B9FE-D2734F61C058'),
  success?: string(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model DescribeSandboxBackupSetsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSandboxBackupSetsResponseBody(name='body'),
}

/**
 * @summary Queries the snapshots of an instance.
 *
 * @description Before you call this operation, you must enable the sandbox feature for the database instance. For more information, see [Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/203154.html) or [Create a sandbox instance for emergency disaster recovery of a self-managed MySQL database](https://help.aliyun.com/document_detail/185577.html). This operation is available only for the Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxBackupSetsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSandboxBackupSetsResponse
 */
async function describeSandboxBackupSetsWithOptions(request: DescribeSandboxBackupSetsRequest, runtime: Util.RuntimeOptions): DescribeSandboxBackupSetsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.backupSetId)) {
    query['BackupSetId'] = request.backupSetId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSandboxBackupSets',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the snapshots of an instance.
 *
 * @description Before you call this operation, you must enable the sandbox feature for the database instance. For more information, see [Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/203154.html) or [Create a sandbox instance for emergency disaster recovery of a self-managed MySQL database](https://help.aliyun.com/document_detail/185577.html). This operation is available only for the Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxBackupSetsRequest
 * @return DescribeSandboxBackupSetsResponse
 */
async function describeSandboxBackupSets(request: DescribeSandboxBackupSetsRequest): DescribeSandboxBackupSetsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSandboxBackupSetsWithOptions(request, runtime);
}

model DescribeSandboxInstancesRequest {
  backupPlanId?: string(name='BackupPlanId', description='The ID of the backup schedule. You can call the [DescribeBackupPlanList](https://help.aliyun.com/document_detail/437215.html) operation to obtain the ID of the backup schedule.

> If your instance is an ApsaraDB RDS for MySQL instance, you can [configure automatic access to a data source](https://help.aliyun.com/document_detail/193091.html) to automatically add the instance to DBS and obtain the ID of the backup schedule.

This parameter is required.', example='1hxxxx8xxxxxa'),
  instanceId?: string(name='InstanceId', description='The ID of the sandbox instance. You can call the [CreateSandboxInstance](https://help.aliyun.com/document_detail/437252.html) operation to obtain the ID of the sandbox instance.', example='1jxxxxnxxx1xc'),
  pageNumber?: string(name='PageNumber', description='The number of the page to return. The value must be an integer that is greater than 0. Default value: 1.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries to return on each page. Valid values:

*   30\\\\. This is the default value.
*   50
*   100', example='30'),
}

model DescribeSandboxInstancesResponseBody = {
  code?: string(name='Code', description='The error code returned if the request fails.', example='Param.NotFound'),
  data?: string(name='Data', description='The response parameters.

*   **connectionString**: the connection string of the sandbox instance, in the format of IP address:Port number. This parameter indicates the endpoint of the sandbox instance if the value of the SandboxType parameter is **Sandbox**. This parameter indicates the Network File System (NFS) mount address if the value of the SandboxType parameter is **NFS**.
*   **restoreSeconds**: the time required to create the sandbox instance. Unit: seconds.
*   **restoreTime**: the point in time to which the sandbox instance is restored. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.
*   **instanceId**: the ID of the sandbox instance.
*   **backupSetId**: the ID of the backup set.
*   **createTime**: the point in time when the sandbox instance was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.
*   **backupPlanId**: the ID of the backup schedule.
*   **vpcId**: the ID of the virtual private cloud (VPC).
*   **vpcSwitchId**: the ID of the VSwitch.
*   **sandboxSpecification**: the specifications of the sandbox instance.
*   **status**: the status of the sandbox instance. Valid values: **running**, **check_pass**, and **stop**.', example='{     "number": 1,     "size": 1,     "content": [       {         "connectionString": "172.26.178.229:3306",         "restoreSeconds": 15,         "restoreTime": "2021-08-11T07:26:24Z",         "instanceId": "1jxxxxx9xxxms",         "backupSetId": "1hxxxx8xxxxxa_20210811152624",         "createTime": "2021-08-12T07:40:29Z",         "backupPlanId": "1hxxxx8xxxxxa",         "vpcId": "vpc-bp1dxxxxxjy0xxxxx1xxp",         "sandboxSpecification": "MYSQL_1C_1M_SD",         "status": "running",         "vpcSwitchId": "vsw-bp1bxxxxxumxxxxxwxx2w"       }     ],     "totalElements": 1   }'),
  errCode?: string(name='ErrCode', description='The error code returned if the request fails.', example='Param.NotFound'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request fails.', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', description='The error message returned if the request fails.', example='The specified parameter %s value is not valid.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4F1888AC-1138-4995-B9FE-D2734F61C058'),
  success?: string(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model DescribeSandboxInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSandboxInstancesResponseBody(name='body'),
}

/**
 * @summary Queries sandbox instances that are created within an account.
 *
 * @description This operation is available only in Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSandboxInstancesResponse
 */
async function describeSandboxInstancesWithOptions(request: DescribeSandboxInstancesRequest, runtime: Util.RuntimeOptions): DescribeSandboxInstancesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSandboxInstances',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries sandbox instances that are created within an account.
 *
 * @description This operation is available only in Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxInstancesRequest
 * @return DescribeSandboxInstancesResponse
 */
async function describeSandboxInstances(request: DescribeSandboxInstancesRequest): DescribeSandboxInstancesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSandboxInstancesWithOptions(request, runtime);
}

model DescribeSandboxRecoveryTimeRequest {
  backupPlanId?: string(name='BackupPlanId', description='The ID of the backup schedule. You can call the [DescribeBackupPlanList](https://help.aliyun.com/document_detail/437215.html) operation to obtain the ID of the backup schedule. If you set this parameter to the backup schedule ID obtained by calling the DescribeBackupPlanList operation, the dbs prefix must be removed. Otherwise, the call fails.

> If your instance is an ApsaraDB RDS for MySQL instance, you can [configure automatic access to a data source](https://help.aliyun.com/document_detail/193091.html) to automatically add the instance to DBS and obtain the ID of the backup schedule.

This parameter is required.', example='1jyjal15l****'),
}

model DescribeSandboxRecoveryTimeResponseBody = {
  code?: string(name='Code', description='The error code returned if the request fails.', example='Param.NotFound'),
  data?: {
    backupPlanId?: string(name='BackupPlanId', description='The backup schedule of the sandbox instance.', example='1hxxxx8xxxxxa'),
    recoveryBeginTime?: string(name='RecoveryBeginTime', description='The beginning of the time range during which the sandbox instance can be restored. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2021-08-01T12:01:01Z'),
    recoveryEndTime?: string(name='RecoveryEndTime', description='The end of the time range during which the sandbox instance can be restored. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2021-08-02T12:01:01Z'),
  }(name='Data', description='The response parameters.'),
  errCode?: string(name='ErrCode', description='The error code returned if the request fails.', example='Param.NotFound'),
  errMessage?: string(name='ErrMessage', description='The error message returned if the request fails.', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', description='The error message returned if the request fails.', example='The specified parameter %s value is not valid.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='4F1888AC-1138-4995-B9FE-D2734F61C058'),
  success?: string(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model DescribeSandboxRecoveryTimeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSandboxRecoveryTimeResponseBody(name='body'),
}

/**
 * @summary Queries the recoverable time range of a sandbox instance.
 *
 * @description Before you call this operation, you must enable the sandbox feature for the database instance. For more information, see [Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/203154.html) or [Create a sandbox instance for emergency disaster recovery of a self-managed MySQL database](https://help.aliyun.com/document_detail/185577.html). This operation is available only in Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxRecoveryTimeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSandboxRecoveryTimeResponse
 */
async function describeSandboxRecoveryTimeWithOptions(request: DescribeSandboxRecoveryTimeRequest, runtime: Util.RuntimeOptions): DescribeSandboxRecoveryTimeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.backupPlanId)) {
    query['BackupPlanId'] = request.backupPlanId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSandboxRecoveryTime',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the recoverable time range of a sandbox instance.
 *
 * @description Before you call this operation, you must enable the sandbox feature for the database instance. For more information, see [Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance](https://help.aliyun.com/document_detail/203154.html) or [Create a sandbox instance for emergency disaster recovery of a self-managed MySQL database](https://help.aliyun.com/document_detail/185577.html). This operation is available only in Database Backup (DBS) API of the 2021-01-01 version.
 *
 * @param request DescribeSandboxRecoveryTimeRequest
 * @return DescribeSandboxRecoveryTimeResponse
 */
async function describeSandboxRecoveryTime(request: DescribeSandboxRecoveryTimeRequest): DescribeSandboxRecoveryTimeResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSandboxRecoveryTimeWithOptions(request, runtime);
}

model ModifyBackupPolicyRequest {
  advanceDataPolicies?: [ 
    {
      actionType?: string(name='ActionType', example='UPDATE'),
      destRegion?: string(name='DestRegion', example='cn-shanghai'),
      destType?: string(name='DestType', example='level1'),
      filterKey?: string(name='FilterKey', example='backupInterval'),
      filterType?: string(name='FilterType', example='crontab'),
      filterTypeCopy?: string(name='FilterType-copy', example='crontab'),
      filterValue?: string(name='FilterValue', example='180'),
      policyId?: string(name='PolicyId', example='6s67c7i3y8f8p72808p******'),
      retentionType?: string(name='RetentionType', example='delay'),
      retentionValue?: string(name='RetentionValue', example='4'),
      srcRegion?: string(name='SrcRegion', example='cn-shanghai'),
      srcType?: string(name='SrcType', example='db'),
    }
  ](name='AdvanceDataPolicies'),
  instanceName?: string(name='InstanceName', example='pc-2ze3nrr64c5****'),
  preferredBackupWindowBegin?: string(name='PreferredBackupWindowBegin', example='17:00Z'),
  regionCode?: string(name='RegionCode', example='cn-shanghai'),
}

model ModifyBackupPolicyResponseBody = {
  code?: string(name='Code', example='Success'),
  data?: {
    advanceDataPolicies?: [ 
      {
        autoCreated?: boolean(name='AutoCreated', example='false'),
        bakType?: string(name='BakType', example='F'),
        destRegion?: string(name='DestRegion', example='cn-shanghai'),
        destType?: string(name='DestType', example='level1'),
        dumpAction?: string(name='DumpAction', example='copy'),
        filterKey?: string(name='FilterKey', example='backupInterval'),
        filterType?: string(name='FilterType', example='crontab'),
        filterValue?: string(name='FilterValue', example='180'),
        policyId?: string(name='PolicyId', example='dc13b153acc91141789122c23835****'),
        retentionType?: string(name='RetentionType', example='delay'),
        retentionValue?: string(name='RetentionValue', example='4'),
        srcRegion?: string(name='SrcRegion', example='cn-shanghai'),
        srcType?: string(name='SrcType', example='db'),
      }
    ](name='AdvanceDataPolicies'),
    preferredBackupWindow?: string(name='PreferredBackupWindow', example='17:00Z-18:00Z'),
    preferredBackupWindowBegin?: string(name='PreferredBackupWindowBegin', example='17:00Z'),
  }(name='Data'),
  errCode?: string(name='ErrCode', example='Success'),
  errMessage?: string(name='ErrMessage', example='The specified parameter %s value is not valid.'),
  message?: string(name='Message', example='instanceName can not be empty.'),
  requestId?: string(name='RequestId', example='D570F209-A166-50C6-98A3-155A20B218B7'),
  success?: string(name='Success', example='true'),
}

model ModifyBackupPolicyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyBackupPolicyResponseBody(name='body'),
}

/**
 * @summary 修改备份策略
 *
 * @param request ModifyBackupPolicyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyBackupPolicyResponse
 */
async function modifyBackupPolicyWithOptions(request: ModifyBackupPolicyRequest, runtime: Util.RuntimeOptions): ModifyBackupPolicyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.advanceDataPolicies)) {
    query['AdvanceDataPolicies'] = request.advanceDataPolicies;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.preferredBackupWindowBegin)) {
    query['PreferredBackupWindowBegin'] = request.preferredBackupWindowBegin;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyBackupPolicy',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改备份策略
 *
 * @param request ModifyBackupPolicyRequest
 * @return ModifyBackupPolicyResponse
 */
async function modifyBackupPolicy(request: ModifyBackupPolicyRequest): ModifyBackupPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyBackupPolicyWithOptions(request, runtime);
}

model ModifyDBTablesRecoveryStateRequest {
  category?: string(name='Category'),
  instanceId?: string(name='InstanceId'),
  regionCode?: string(name='RegionCode'),
  retention?: string(name='Retention'),
}

model ModifyDBTablesRecoveryStateResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model ModifyDBTablesRecoveryStateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDBTablesRecoveryStateResponseBody(name='body'),
}

/**
 * @param request ModifyDBTablesRecoveryStateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDBTablesRecoveryStateResponse
 */
async function modifyDBTablesRecoveryStateWithOptions(request: ModifyDBTablesRecoveryStateRequest, runtime: Util.RuntimeOptions): ModifyDBTablesRecoveryStateResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.category)) {
    query['Category'] = request.category;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!Util.isUnset(request.retention)) {
    query['Retention'] = request.retention;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDBTablesRecoveryState',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ModifyDBTablesRecoveryStateRequest
 * @return ModifyDBTablesRecoveryStateResponse
 */
async function modifyDBTablesRecoveryState(request: ModifyDBTablesRecoveryStateRequest): ModifyDBTablesRecoveryStateResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDBTablesRecoveryStateWithOptions(request, runtime);
}

model SupportDBTableRecoveryRequest {
  instanceId?: string(name='InstanceId'),
  regionCode?: string(name='RegionCode'),
}

model SupportDBTableRecoveryResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model SupportDBTableRecoveryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SupportDBTableRecoveryResponseBody(name='body'),
}

/**
 * @param request SupportDBTableRecoveryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SupportDBTableRecoveryResponse
 */
async function supportDBTableRecoveryWithOptions(request: SupportDBTableRecoveryRequest, runtime: Util.RuntimeOptions): SupportDBTableRecoveryResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SupportDBTableRecovery',
    version = '2021-01-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request SupportDBTableRecoveryRequest
 * @return SupportDBTableRecoveryResponse
 */
async function supportDBTableRecovery(request: SupportDBTableRecoveryRequest): SupportDBTableRecoveryResponse {
  var runtime = new Util.RuntimeOptions{};
  return supportDBTableRecoveryWithOptions(request, runtime);
}

